/**
 * 
 */
package io;

import java.util.ArrayList;

import evolution.Gene;
import evolution.Individual;

/**
 * @author vtkhanh
 * 
 */
public class Output {

    public static void print(Individual individual) {
	ArrayList<Gene> genes = individual.getGenes();

	for (short i = 0; i < 5; i++) {
	    System.out.println("Day " + i + ":");
	    for (short j = 0; j < 10; j++) {
		for (Gene gene : genes) {
		    int timeslot = gene.getTimeslot();
		    if (((timeslot / 10) == i) && ((timeslot % 10) == j)) {
			System.out.print("Gene " + gene.getGeneId() + " : ");
			System.out.print("Period " + j + " | ");
			System.out.print("Room " + gene.getRoomId() + " | ");
			System.out.print("Subject " + gene.getCourse().getSubject().getSubjectId() + " | ");
			System.out.print("Unit " + gene.getCourse().getPeriod() + " | ");
			System.out.print("Group " + gene.getCourse().getGroup().getGroupId() + " | ");
			System.out.print("Teacher " + gene.getCourse().getTeacher().getTeacherId() + " | ");
			System.out.println();
		    }
		}
	    }	    
	}
	
	printCost("cost: ", individual.getCost());
	System.out.println("---------------------------------------------------");
    }
    
    public static void printCost(String  message, int cost) {
	System.out.println(message + cost);
    }

}
